{template 'common/header'}
<ul class="nav nav-tabs">
    <li class="active"><a href="{php echo $this->createWebUrl('tongji');}">打卡列表</a></li>
</ul>
<script type="text/javascript">

    $(document).ready(function () {
        var val = $('#pid').val();
        change_pid(val);
        $('#pid').bind("change", function () {
            var v = $(this).val();
            $.post("../app/{php echo $this->createMobileUrl('pid')}", {'pid': v},
                function (data) {
                    $('#pid2').html(data);
                });
        });
    });
    function change_pid(v) {
        $.post("../app/{php echo $this->createMobileUrl('pid')}", {'pid': v},
            function (data) {
                $('#pid2').html(data);
            });
    }
</script>
<div class="panel panel-info">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">
        <form action="./index.php" method="get" class="form-horizontal" role="form">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="haofa_kaoqin" />
            <input type="hidden" name="do" value="tongji" />
            <div class="form-group">
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <select name="bumen" class="form-control" id="pid">
                        <option value="">请选择部门</option>
                        {loop $bumen $index $item}
                        <option value="{$item['id']}">{$item['name']}</option>
                        {/loop}
                    </select>
                </div>
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <select name="jingwushi" class="form-control" id="pid2">
                        <option value="">请选择警卫室</option>
                    </select>
                </div>
                <div class="col-xs-12 col-sm-3 col-lg-3">
                    <select name="year" class="form-control">
                        <option value="">选择年份</option>
                        <option value="2017">2017</option>
                        <option value="2018">2018</option>
                        <option value="2019">2019</option>
                    </select>
                </div>

                <div class="col-xs-12 col-sm-3 col-lg-3">
                    <select name="month" class="form-control">
                        <option value="">选择月份</option>
                        <option value="1">1月</option>
                        <option value="2">2月</option>
                        <option value="3">3月</option>
                        <option value="4">4月</option>
                        <option value="5">5月</option>
                        <option value="6">6月</option>
                        <option value="7">7月</option>
                        <option value="8">8月</option>
                        <option value="9">9月</option>
                        <option value="10">10月</option>
                        <option value="11">11月</option>
                        <option value="12">12月</option>
                    </select>
                </div>

                <div class="pull-right col-xs-12 col-sm-3 col-md-2 col-lg-2">
                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                </div>
            </div>
        </form>
    </div>
</div>

{if $ftime}
<div class="panel panel-info">
    <div class="panel-heading">导出</div>
    <div class="panel-body">
        <form action="./index.php" method="get" class="form-horizontal" role="form">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="haofa_kaoqin" />
            <input type="hidden" name="do" value="export" />
            <input type="hidden" name="year" value="{$_GPC['year']}" />
            <input type="hidden" name="month" value="{$_GPC['month']}" />
            <input type="hidden" name="bumen" value="{$_GPC['bumen']}" />
            <input type="hidden" name="jingweishi" value="{$_GPC['jingwushi']}" />
            <div class="form-group">
                <div class="col-xs-12 col-sm-2 col-lg-2">
                    <button class="btn btn-success">导出</button>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <tbody id="main">
            <tr>
                <th width="100">{$_GPC['year']}年{$_GPC['month']}月</th>
                <th>01</th>
                <th>02</th>
                <th>03</th>
                <th>04</th>
                <th>05</th>
                <th>06</th>
                <th>07</th>
                <th>08</th>
                <th>09</th>
                <th>10</th>
                <th>11</th>
                <th>12</th>
                <th>13</th>
                <th>14</th>
                <th>15</th>
                <th>16</th>
                <th>17</th>
                <th>18</th>
                <th>19</th>
                <th>20</th>
                <th>21</th>
                <th>22</th>
                <th>23</th>
                <th>24</th>
                <th>25</th>
                <th>26</th>
                <th>27</th>
                <th>28</th>
                <th>29</th>
                <th>30</th>
                <th>31</th>
            </tr>
            {loop $user $index $item}
            <tr>
                <td>{$item['name']}</td>
                {loop $ll $key $value}
                <td>
                    <div style="border:solid 1px #efefef;text-align:center;margin-bottom:5px;">
                        <span style="color:red;">
                            {loop $item['user_day'] $k $val}
                            {if $key==$val['day'] && $val['shangwu'] }{php $kkk[$key][$item['name']]=1;}{/if}
                            {/loop}
                                  {if $kkk[$key][$item['name']] }<a href="./index.php?c=site&a=entry&m=haofa_kaoqin&do=manage&id={$val['id']}">√</a>{else}×{/if}
                        </span>
                    </div>
                    <div style="border:solid 1px #efefef;text-align:center;margin-bottom:5px;">
                        <span style="color:red;">
                            {loop $item['user_day'] $k $val}
                             {if $key==$val['day'] && $val['xiawu'] }{php $kkk2[$key][$item['name']]=1;}{/if}
                            {/loop}
                            {if $kkk2[$key][$item['name']] }<a href="./index.php?c=site&a=entry&m=haofa_kaoqin&do=manage&id={$val['id']}">√</a>{else}×{/if}
                        </span>
                    </div>
                </td>
                {/loop}
            </tr>
            {/loop}
            </tbody>
        </table>
    </div>
</div>

{/if}
{template 'common/footer'}